package com.infore.statisticsAndAlarm.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.infore.statisticsAndAlarm.entity.FileType;
import com.infore.statisticsAndAlarm.service.IFileTypeService;
import com.infore.statisticsAndAlarm.util.ResultEntity;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "知识库文件类型管理接口", tags = { "知识库文件类型管理接口" })
@RestController
@RequestMapping("/fileTypes")
public class FileTypeController {

	@Autowired
	private IFileTypeService iFileTypeService;

	@ApiOperation(value = "根据知识库类型获取文件分类")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "knowledgeType", value = "知识库类型(1-6)", paramType = "query", required = true, dataType = "String") })
	@GetMapping(value = "queryFileTypes")
	public ResultEntity queryFileTypeByBase(String knowledgeType) {
		return iFileTypeService.queryFileTypeByBase(knowledgeType);
	}

	@ApiOperation(value = "删除文件分类接口")
	@ApiImplicitParams({
			@ApiImplicitParam(name = "ids", value = "文件分类id", paramType = "query", required = true, dataType = "String") })
	@DeleteMapping(value = "deleteFileTypes")
	public ResultEntity deleteFileTypes(String ids) {
		return iFileTypeService.deleteFileTypes(ids);
	}

	@ApiOperation(value = "编辑新增接口")
	@ResponseBody
	@PostMapping(value = "addOrEdit")
	public ResultEntity addOrEdit(@RequestBody List<FileType> fileTypes) {
		return iFileTypeService.addOrEdit(fileTypes);
	}

}
